export default {
    data() {
        return {
            //图片上传相关
            dialogImageUrl: '',
            dialogVisible: false,
            disabled: false,
            fileList: [],
            headers: {
                token: sessionStorage.getItem('token')
            }
        }
    },
    methods: {
        /**
         * 图片上传相关
         */
        handleChange(file, fileList) {
            this.fileList = fileList
        },
        handleRemove() {
            this.fileList = []
        },
        handlePictureCardPreview(file) {
            this.dialogImageUrl = file.url;
            this.dialogVisible = true;
        },
        handleError() {
            this.$message.error("服务器错误，请稍后重试")
        },
        upload() {
            if (this.fileList.length > 0) {
                this.$refs.upload.submit()
            } else {
                this.addOrEditData()
            }
        }
    },
    computed: {
        uploadDisabled() {
            return this.fileList.length !== 0;
        }
    }
}